package com.the4man.framework.util;

import java.util.Map;

/**
 * Created by lenovo on 2017/12/12.
 */
public class ReflectUtil {
    public ReflectUtil() {
    }

    public static Object isPage(Object obj, String fieldName) {
        if(obj instanceof Map) {
            Map map = (Map)obj;
            return map.get(fieldName);
        } else {
            Class superClass = obj.getClass();

            while(superClass != Object.class) {
                try {
                    return superClass.getDeclaredField(fieldName);
                } catch (NoSuchFieldException var4) {
                    superClass = superClass.getSuperclass();
                }
            }

            return null;
        }
    }
}
